home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9657 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: nova.umuc.edu!not-for-mail
  2. From: srussell@nova.umuc.edu (Steve Russell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Class
  5. Date: 3 Mar 1996 11:35:29 -0500
  6. Organization: University of Maryland University College
  7. Message-ID: <4hchoh$ngh@nova.umuc.edu>
  8. NNTP-Posting-Host: nova.umuc.edu
  9.  
  10. Well, the day has arrived.  My teacher not only has me doing c++ on
  11. unix, but OBJECT ORIENTATED PROGRAMMING as well ( drum roll abruptley stops).
  12.  
  13. Its my first program making my own classes so I have a few general questions
  14. that I didn't think to ask my professor while I had the chance, and as
  15. usual my text book fails me:
  16.  
  17. 1. Can I read from and output to files directly from the class?  Can
  18.    I include<fstream.h> in the class?  Do I need to include other things
  19.    like iostream.h and other various libraries for library functions?
  20.  
  21.  
  22. 2. I would like to reuse this class so I plan on saving the entire class
  23.    in a seperate file.  I plan on running the entire program on unix.
  24.    After I include the header file for the class in the mainprogram is
  25.    there anything else special I have to do?
  26.  
  27. 3. Is this the right way to right a file for a class in unix:
  28.  
  29.     //FILE: EmpRecords.h
  30.        // MANIPULATES EMPLOYEE RECORDS
  31.        #ifdef EMPLOYEERECORDS_H_
  32.        #define EMPLOYEERECORDS_H_
  33.  
  34.     // class definition, and member function definitions
  35.     
  36.     #endif//end of EmpRecords.h
  37.  
  38.  
  39. 4.  Finally, my class has a struct in it.  This struct has a char array in it.
  40.     Do I need to initialize this struct via a constructor function?  If so
  41.     would it be sufficent to set all the attributes of the struct to zero
  42.     and give a dummy name to the string?
  43.  
  44.  
  45. Thanks
  46. Steve
  47.